<pre class="code">
<span class="srcline"><span class="lineno"><a href="21,1" id="srcline1"> 1</a></span><span class="line"><span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span></span></span>
<span class="srcline"><span class="lineno"><a href="21,2" id="srcline2"> 2</a></span><span class="line"><span class="comment">% RPI-MATLAB-Simulator</span></span></span>
<span class="srcline"><span class="lineno"><a href="21,3" id="srcline3"> 3</a></span><span class="line"><span class="comment">% http://code.google.com/p/rpi-matlab-simulator/</span></span></span>
<span class="srcline"><span class="lineno"><a href="21,4" id="srcline4"> 4</a></span><span class="line"><span class="comment">%</span></span></span>
<span class="srcline"><span class="lineno"><a href="21,5" id="srcline5"> 5</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="21,6" id="srcline6"> 6</a></span><span class="line"><span class="keyword">function</span> <span class="var type1" id="S2T32U3">body</span> = Body_sphere( <span class="mxinfo" id="T1:U2"><span class="mxinfo" id="T1:U3"><span class="var type1" id="S3T1U6">mass</span></span></span>, <span class="mxinfo" id="T1:U5"><span class="mxinfo" id="T1:U6"><span class="var type1" id="S4T1U7">radius</span></span></span> )</span></span>
<span class="srcline"><span class="lineno"><a href="21,7" id="srcline7"> 7</a></span><span class="line"><span class="comment">%#codegen</span></span></span>
<span class="srcline"><span class="lineno"><a href="21,8" id="srcline8"> 8</a></span><span class="line">    <span class="var type1" id="S2T32U10">body</span> = <span class="mxinfo" id="T17:U9"><span class="fcn" id="F31N2:B12">Body</span>()</span>;</span></span>
<span class="srcline"><span class="lineno"><a href="21,9" id="srcline9"> 9</a></span><span class="line">    <span class="mxinfo" id="T33:U10"><span class="mxinfo" id="T33:U11"><span class="var type1" id="S2T32U16">body</span>.type</span> = <span class="mxinfo" id="T12:U13"><span class="string">'sphere'</span></span></span>; </span></span>
<span class="srcline"><span class="lineno"><a href="21,10" id="srcline10">10</a></span><span class="line">    <span class="mxinfo" id="T1:U14"><span class="mxinfo" id="T1:U15"><span class="var type1" id="S2T32U22">body</span>.radius</span> = <span class="mxinfo" id="T1:U17"><span class="var type1" id="S4T1U24">radius</span></span></span>; </span></span>
<span class="srcline"><span class="lineno"><a href="21,11" id="srcline11">11</a></span><span class="line">    <span class="mxinfo" id="T16:U19"><span class="mxinfo" id="T16:U20"><span class="var type1" id="S2T32U28">body</span>.J</span> = <span class="mxinfo" id="T16:U22">(<span class="mxinfo" id="T1:U23">2*<span class="var type1" id="S3T1U36">mass</span>*<span class="var type1" id="S4T1U38">radius</span>^2 / 5</span>) * eye(3)</span></span>;</span></span>
<span class="srcline"><span class="lineno"><a href="21,12" id="srcline12">12</a></span><span class="line"></span></span>
<span class="srcline"><span class="lineno"><a href="21,13" id="srcline13">13</a></span><span class="line"><span class="keyword">end</span></span></span>
<span class="srcline"><span class="lineno"><a href="21,14" id="srcline14">14</a></span><span class="line"></span></span>
</pre>
